package com.study_security.dto;

import lombok.Data;

@Data
public class Resp<T> {
    private Integer code;
    private String msg;
    private T data;
    public static <T> Resp<T> success(T data)
    {
        Resp<T> result=new Resp<>();
        result.setCode(200);
        result.setData(data);
        return result;
    }

    public static <T> Resp<T> error(HttpStatus status)
    {
        Resp<T> result=new Resp<>();
        result.setCode(status.getCode());
        result.setMsg(status.getMsg());
        return result;
    }

}
